﻿/*
 * 文件名称：
 * 程序员：huangsb
 * 创建时间：2008/05/10
 * 
 * 功能说明：错误日志
 * 
 * 修改人员：
 * 
 * 修改日期：
 * 
 * 修改记录：
 */

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Whir_System_Module_Log_ErrorLog : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RoleHelper.IsLogin();

        if (!IsPostBack)
        {
            BindData();
        }
    }

    //绑定
    protected void BindData()
    {
        DataSet ds = Whir.SQLServerDAL.DbHelperSQL.GetList("Whir_ErrorLog", "createDate", "*,(select adminName from Whir_AdminInfo where adminID=errorUserID) errorUser", AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex - 1, "", "", "createDate desc");
        int rowCount = int.Parse(ds.Tables[1].Rows[0][0].ToString());
        AspNetPager1.RecordCount = rowCount;
        if (rowCount > 0)
        {
            GridView1.DataSource = ds;
            GridView1.DataBind();
            divMessage.Visible = false;
        }
        else
        {
            GridView1.Controls.Clear();
            divMessage.Visible = true;
            divDelete.Visible = false;
        }
    }

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        BindData();
    }

    //删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int[] cbs = this.GridView1.CheckedIndexs;

        if (cbs.Length == 0)
        {
            Whir.Common.WebHelper.JsHelper.Alert(Page, "请选择记录!");
            return;
        }

        Whir.Log.SQLServerDAL.Whir_ErrorLog bll = new Whir.Log.SQLServerDAL.Whir_ErrorLog();
        foreach (int cb in cbs)
        {
            bll.Delete(cb);
        }

        BindData();

        Whir.Common.WebHelper.JsHelper.Alert(Page, "删除成功!");
    }
}
